/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.xteam.box2text.box.util;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

import org.xteam.box2text.box.*;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.xteam.box2text.box.BoxPackage
 * @generated
 */
public class BoxSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static BoxPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BoxSwitch() {
		if (modelPackage == null) {
			modelPackage = BoxPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case BoxPackage.BOX: {
				Box box = (Box)theEObject;
				T result = caseBox(box);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.OPERATOR: {
				Operator operator = (Operator)theEObject;
				T result = caseOperator(operator);
				if (result == null) result = caseBox(operator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.OPTION: {
				Option option = (Option)theEObject;
				T result = caseOption(option);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.TEXT_BOX: {
				TextBox textBox = (TextBox)theEObject;
				T result = caseTextBox(textBox);
				if (result == null) result = caseBox(textBox);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.AOPERATOR: {
				AOperator aOperator = (AOperator)theEObject;
				T result = caseAOperator(aOperator);
				if (result == null) result = caseOperator(aOperator);
				if (result == null) result = caseBox(aOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.ALIGNMENT_OPTION: {
				AlignmentOption alignmentOption = (AlignmentOption)theEObject;
				T result = caseAlignmentOption(alignmentOption);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.IOPERATOR: {
				IOperator iOperator = (IOperator)theEObject;
				T result = caseIOperator(iOperator);
				if (result == null) result = caseOperator(iOperator);
				if (result == null) result = caseBox(iOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.HOPERATOR: {
				HOperator hOperator = (HOperator)theEObject;
				T result = caseHOperator(hOperator);
				if (result == null) result = caseOperator(hOperator);
				if (result == null) result = caseBox(hOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.VOPERATOR: {
				VOperator vOperator = (VOperator)theEObject;
				T result = caseVOperator(vOperator);
				if (result == null) result = caseOperator(vOperator);
				if (result == null) result = caseBox(vOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.GOPERATOR: {
				GOperator gOperator = (GOperator)theEObject;
				T result = caseGOperator(gOperator);
				if (result == null) result = caseOperator(gOperator);
				if (result == null) result = caseBox(gOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.SL_OPERATOR: {
				SLOperator slOperator = (SLOperator)theEObject;
				T result = caseSLOperator(slOperator);
				if (result == null) result = caseGOperator(slOperator);
				if (result == null) result = caseOperator(slOperator);
				if (result == null) result = caseBox(slOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.HOV_OPERATOR: {
				HOVOperator hovOperator = (HOVOperator)theEObject;
				T result = caseHOVOperator(hovOperator);
				if (result == null) result = caseOperator(hovOperator);
				if (result == null) result = caseBox(hovOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.HV_OPERATOR: {
				HVOperator hvOperator = (HVOperator)theEObject;
				T result = caseHVOperator(hvOperator);
				if (result == null) result = caseOperator(hvOperator);
				if (result == null) result = caseBox(hvOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.ROPERATOR: {
				ROperator rOperator = (ROperator)theEObject;
				T result = caseROperator(rOperator);
				if (result == null) result = caseOperator(rOperator);
				if (result == null) result = caseBox(rOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case BoxPackage.WD_OPERATOR: {
				WDOperator wdOperator = (WDOperator)theEObject;
				T result = caseWDOperator(wdOperator);
				if (result == null) result = caseOperator(wdOperator);
				if (result == null) result = caseBox(wdOperator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Box</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Box</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseBox(Box object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Operator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Operator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseOperator(Operator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Option</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Option</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseOption(Option object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Text Box</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Text Box</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTextBox(TextBox object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>AOperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>AOperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAOperator(AOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Alignment Option</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Alignment Option</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAlignmentOption(AlignmentOption object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IOperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IOperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIOperator(IOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>HOperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>HOperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseHOperator(HOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>VOperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>VOperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseVOperator(VOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>GOperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>GOperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGOperator(GOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>SL Operator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>SL Operator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseSLOperator(SLOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>HOV Operator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>HOV Operator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseHOVOperator(HOVOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>HV Operator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>HV Operator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseHVOperator(HVOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>ROperator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>ROperator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseROperator(ROperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>WD Operator</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>WD Operator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseWDOperator(WDOperator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //BoxSwitch
